<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('H5游戏列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>横竖屏：</p>
                                <select name="display" th:with="type=${@dict.getType('game_display_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>国内外：</p>
                                <select name="domestic" th:with="type=${@dict.getType('game_domestic_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>名字：</p>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <p>状态：</p>
                                <select name="status" th:with="type=${@dict.getType('game_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="game:game:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="game:game:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="game:game:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="game:game:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('game:game:edit')}]];
        var removeFlag = [[${@permission.hasPermi('game:game:remove')}]];
        var displayDatas = [[${@dict.getType('game_display_type')}]];
        var domesticDatas = [[${@dict.getType('game_domestic_type')}]];
        var recomDatas = [[${@dict.getType('common_support')}]];
        var statusDatas = [[${@dict.getType('game_status')}]];
        var iosDatas = [[${@dict.getType('common_support')}]];
        var androidDatas = [[${@dict.getType('common_support')}]];
        var linkCheckDatas = [[${@dict.getType('common_support')}]];
        var prefix = ctx + "game/game";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "H5游戏",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id', 
                    title : 'id',
                    visible: false
                },
                {
                    field : 'name', 
                    title : '名字'
                },
                {
                    field : 'icon', 
                    title : '图标',
                    formatter: function(value, row, index) {
                    	var img = value;
                    	if(!img){
                    		img = "http://img.kkc.cdn.youzhi.net/5b782c9ddf6b08c6e9bdfda626d35091.jpeg";
                    	}
                        return "<a href='http://biuugames.huya.com/" + row.url + "' target='_blank'><img src='" + img + "' width=80 height=80/></a>" ;
                    }
                },
                {
                    field : 'url', 
                    title : '链接',
                    visible: false
                },
                {
                    field : 'display', 
                    title : '横竖屏',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(displayDatas, value);
                    }
                },
                {
                    field : 'domestic', 
                    title : '国内外',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(domesticDatas, value);
                    }
                },
                {
                    field : 'shortDesc', 
                    title : '描述(短)'
                },
                {
                    field : 'createdTime', 
                    title : '创建时间',
                    visible: false
                },
                {
                    field : 'createdUserId', 
                    title : '创建用户',
                    visible: false
                },
                {
                    field : 'deployTime', 
                    title : '发布时间'
                }
                ,
                {
                    field : 'source', 
                    title : '来源'
                },
                {
                    field : 'nameEn', 
                    title : '名字(英文)'
                },
                {
                    field : 'status', 
                    title : '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field : 'recom', 
                    title : '推荐',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(recomDatas, value);
                    }
                },
                {
                    field : 'playCount', 
                    title : '玩次数',
                    visible: false
                },
                {
                    field : 'ios', 
                    title : '支持iOS',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(iosDatas, value);
                    }
                },
                {
                    field : 'android', 
                    title : '支持安卓',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(androidDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editFull(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>